/*
 * Created on 4 mai 2006
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.broadvision.bvgs.multilang.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.DynaValidatorForm;

import com.broadvision.bvgs.multilang.MultilangUtils;
import com.broadvision.data.client.Content;

/**
 * @author hmartin
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class ProgramMultilangRemoveAction extends ProgramMultilangViewAction {
	public ActionForward processExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    throws Exception
	{
		updateMultilang(request, form);
		return super.processExecute(mapping,form,request, response);
	}
	
	protected void updateMultilang(HttpServletRequest request, ActionForm form){
		String language = ((DynaValidatorForm) form).getString("languageToRemove");
		Content content = getContentToTranslate(request);
		MultilangUtils.removeMultilangName(content, language, getTranslationTableName(), getTranslationLanguageFieldName());
	}

}
